---
category: Validator
contributors:
    - robinpokorny
created: '2020-04-19'
title: Check if an object is empty
updated: '2021-10-13'
---

**JavaScript version**

```js isEmpty.js
const isEmpty = (obj) => Reflect.ownKeys(obj).length === 0 && obj.constructor === Object;

// Or for enumerable property names only
const isEmpty = (obj) => JSON.stringify(obj) === '{}';
```

**TypeScript version**

```ts isEmpty.ts
const isEmpty = (obj: object): boolean => Reflect.ownKeys(obj).length === 0 && obj.constructor === Object;

const isEmpty = (obj: object): boolean => JSON.stringify(obj) === '{}';
```
